﻿Option Strict On
Option Explicit On
Option Infer On
Imports System.Text.RegularExpressions
Imports SSTA.WinForms.Controls
Public Class SearchableListBoxTestForm
    Inherits System.Windows.Forms.Form

    Public Sub New()
        InitializeComponent()
    End Sub

    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub
    Private components As System.ComponentModel.IContainer




    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.Panel1 = New System.Windows.Forms.Panel()
        Me.SearchTextBox = New System.Windows.Forms.TextBox()
        Me.SearhButton = New System.Windows.Forms.Button()
        Me.SearchableListBox1 = New SSTA.WinForms.Controls.SearchableListBox()
        Me.Panel1.SuspendLayout()
        Me.SuspendLayout()
        '
        'Panel1
        '
        Me.Panel1.Controls.Add(Me.SearchTextBox)
        Me.Panel1.Controls.Add(Me.SearhButton)
        Me.Panel1.Dock = System.Windows.Forms.DockStyle.Top
        Me.Panel1.Location = New System.Drawing.Point(0, 0)
        Me.Panel1.Name = "Panel1"
        Me.Panel1.Size = New System.Drawing.Size(395, 36)
        Me.Panel1.TabIndex = 1
        '
        'SearchTextBox
        '
        Me.SearchTextBox.Location = New System.Drawing.Point(13, 7)
        Me.SearchTextBox.Name = "SearchTextBox"
        Me.SearchTextBox.Size = New System.Drawing.Size(289, 20)
        Me.SearchTextBox.TabIndex = 1
        '
        'SearhButton
        '
        Me.SearhButton.Location = New System.Drawing.Point(308, 7)
        Me.SearhButton.Name = "SearhButton"
        Me.SearhButton.Size = New System.Drawing.Size(75, 23)
        Me.SearhButton.TabIndex = 2
        Me.SearhButton.Text = "&Search"
        Me.SearhButton.UseVisualStyleBackColor = True
        '
        'SearchableListBox1
        '
        Me.SearchableListBox1.Dock = System.Windows.Forms.DockStyle.Fill
        Me.SearchableListBox1.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawVariable
        Me.SearchableListBox1.FormattingEnabled = True
        Me.SearchableListBox1.Location = New System.Drawing.Point(0, 36)
        Me.SearchableListBox1.Name = "SearchableListBox1"
        Me.SearchableListBox1.SearchText = Nothing
        Me.SearchableListBox1.Size = New System.Drawing.Size(395, 226)
        Me.SearchableListBox1.TabIndex = 3
        '
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(395, 262)
        Me.Controls.Add(Me.SearchableListBox1)
        Me.Controls.Add(Me.Panel1)
        Me.Name = "SearchableListBoxTestForm"
        Me.Text = "SearchableListBox Test"
        Me.Panel1.ResumeLayout(False)
        Me.Panel1.PerformLayout()
        Me.ResumeLayout(False)
    End Sub
    Friend WithEvents Panel1 As System.Windows.Forms.Panel
    Friend WithEvents SearchTextBox As System.Windows.Forms.TextBox
    Friend WithEvents SearhButton As System.Windows.Forms.Button
    Friend WithEvents SearchableListBox1 As SSTA.WinForms.Controls.SearchableListBox
    Private Sub SearchableListBoxTestForm_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        SearchableListBox1.DrawMode = DrawMode.OwnerDrawVariable
        'Borrowed from https://en.wikipedia.org/wiki/Hitchhike
        SearchableListBox1.Items.Add("1934 - It Happened One Night")
        SearchableListBox1.Items.Add("1937 - Way Out West")
        SearchableListBox1.Items.Add("1945 - Detour")
        SearchableListBox1.Items.Add("1953 - The Hitch-Hiker")
        SearchableListBox1.Items.Add("1963 - It's a Mad, Mad, Mad, Mad World")
        SearchableListBox1.Items.Add("1974 - The Texas Chain Saw Massacre")
        SearchableListBox1.Items.Add("1977 - Hitch-Hike")
        SearchableListBox1.Items.Add("1981 - Roadgames")
        SearchableListBox1.Items.Add("1983 - Going Back")
        SearchableListBox1.Items.Add("1985 - Pee-wee's Big Adventure")
        SearchableListBox1.Items.Add("1985 - The Sure Thing")
        SearchableListBox1.Items.Add("1986 - The Hitcher")
        SearchableListBox1.Items.Add("1989 - Kiki's Delivery Service")
        SearchableListBox1.Items.Add("1990 - Nouvelle Vague")
        SearchableListBox1.Items.Add("1994 - Even Cowgirls Get the Blues")
        SearchableListBox1.Items.Add("1998 - Something About Mary")
        SearchableListBox1.Items.Add("2000 - O Brother, Where Art Thou?")
        SearchableListBox1.Items.Add("2001 - 3000 Miles to Graceland")
        SearchableListBox1.Items.Add("2001 - Jay and Silent Bob Strike Back")
        SearchableListBox1.Items.Add("2003 - The Hitcher II: I've Been Waiting")
        SearchableListBox1.Items.Add("2003 - The Haunted Mansion")
        SearchableListBox1.Items.Add("2004 - EuroTrip")
        SearchableListBox1.Items.Add("2004 - Crash")
        SearchableListBox1.Items.Add("2004 - Riding the Bullet")
        SearchableListBox1.Items.Add("2005 - The Hitchhiker's Guide to the Galaxy")
        SearchableListBox1.Items.Add("2007 - The Hitcher")
        SearchableListBox1.Items.Add("2007 - Mr. Bean's Holiday")
        SearchableListBox1.Items.Add("2007 - Into the Wild")
        SearchableListBox1.Items.Add("2007 - Have Dreams, Will Travel")
        SearchableListBox1.Items.Add("2008 - The Yellow Handkerchief")
        SearchableListBox1.Items.Add("2013 - Man of Steel (film)")
    End Sub
    Private Sub SearhButton_Click(sender As System.Object, e As System.EventArgs) Handles SearhButton.Click
        SearchableListBox1.SearchText = SearchTextBox.Text
    End Sub
    Private Sub SearchTextBox_TextChanged(sender As System.Object, e As System.EventArgs) Handles SearchTextBox.TextChanged
        SearchableListBox1.SearchText = SearchTextBox.Text
    End Sub
End Class